
<nz-card>
  <div nz-row nzGutter="8">
    <!-- 查询字段小于或等于3个时，不显示伸缩按钮 -->
    <div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
      <sf
        #sf
        [schema]="schema"
        [ui]="ui"
        [mode]="'search'"
        [disabled]="!sf?.valid"
        [loading]="false"
        (formSubmit)="st?.load(1)"
        (formReset)="resetSF()"
      ></sf>
    </div>

    <!-- 查询字段大于3个时，根据展开状态调整布局 -->
    <ng-container>
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'">
          <ng-template sf-template="signTime" let-me let-ui="ui" let-schema="schema">
            <ng-template sf-template="effectiveEndTime" let-me let-ui="ui" let-schema="schema">
              <nz-range-picker [nzShowTime]="true" [(ngModel)]="sf.value.effectiveEndTime"></nz-range-picker>
            </ng-template>
            <nz-range-picker [nzShowTime]="true" [(ngModel)]="sf.value.signTime"></nz-range-picker>
          </ng-template>
        </sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
        <button
          nz-button
          nzType="primary"
          [disabled]="!sf.valid"
          [nzLoading]="isLoading && st.loading"
          (click)="st?.load(1)"
          acl
          [acl-ability]="['CONTRACT-INDEX-listFrame']"
          >查询</button
        >
        <button nz-button (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
    </ng-container>
  </div>
</nz-card>

<nz-card class="content-box" nzBordered>
  <div style="position: relative">
    <nz-alert
      nzType="info"
      [nzMessage]="'当前共' + st?.total + '行记录，已选择' + selectedRows.length + '项'"
      nzShowIcon
      [ngStyle]="{ margin: '0 0 1rem 0' }"
    >
    </nz-alert>
  </div>

  <st
    #st
    [data]="service.$api_listFrame_page"
    [columns]="columns"
    [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
    [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
    [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
    [loading]="service.http.loading"
    [scroll]="{ x: '1200px', y: '370px' }"
    (change)="stChange($event)"
  >
    <ng-template st-row="contractCode" let-item let-index="index">
      <a *ngIf="item.esignFlowStatus == '2'" (click)="service.openURL(item?.contractFilePath)">{{ item?.contractCode }}</a>
      <a *ngIf="item.esignFlowStatus !== '2'" [routerLink]="'/contract-management/index/detail/' + item.id">{{ item?.contractCode }}</a>
    </ng-template>
    <ng-template st-row="effectiveEndTime" let-item let-index="index">
      <div  >{{ item?.effectiveEndTime ? item?.effectiveEndTime : '长期' }}</div>
    </ng-template>
  </st>
</nz-card>

<ng-template #auditModal>
  <div nz-row nzGutter="8">
    <div nz-col nzSpan="24" se-container [labelWidth]="80">
      <se [col]="1" label="备注">
        <textarea
          nz-input
          rows="3"
          placeholder="同意可以不用填写原因 ，拒绝必须说明原因"
          style="width: 325px; margin-left: 14px"
        ></textarea>
      </se>
    </div>
  </div>
</ng-template>
